﻿<!DOCTYPE html>
<html><head>
<meta charset="UTF-8">
<title>个人中心</title>
<link rel="stylesheet" type="text/css" href="css/index.css">
<script type="text/javascript" src="js/jquery-3.4.1.js"></script>
</head>
<body class="index">
	<div class="ucenter container">
		<div class="header" id="header">
			<h1 class="logo">
				<a title="" style="background: url(images/logo.png)" href="index.jsp">电子商务平台</a>
			</h1>
			<!-- <ul class="shortcut">
				<li class="first"><a href="personal.html">个人中心</a></li>
				<li><a href="myOrders.html">我的订单</a></li>
			</ul>
			<p class="loginfo" id="loginfo"></p> -->
<!--		<ul class="shortcut"><li class="first"><a href="personal.html">个人中心</a></li><li><a href="myOrders.html">我的订单</a></li></ul><p class="loginfo">你好!17760990684[<a href="javaScript:logout()">安全退出</a>]</p></div>-->
<!--		<div class="navbar" style="margin-bottom: 50px">-->
<!--			<ul id="navbarUl">-->

<!--			</ul>-->
			<div id="login"></div>
			<script>
				$(function () {
					var user=JSON.parse(window.sessionStorage.getItem("user"));
					if(user!=undefined){
						var $ul="<ul class=\"shortcut\">\n" +
								"        <li class=\"first\"><a href=\"personal.html\">个人中心</a></li>\n" +
								"        <li><a href=\"myOrders.html\">我的订单</a></li>\n" +
								"        <p class=\"loginfo\">你好!"+""+"[<a href=\"javaScript:logout()\">安全退出</a>]</p>\n" +
								"    </ul>";
						$("#login").html($ul);
						$.ajax({
							url:"Cart.do",
							data:{
								method:"findByCart",
								userid:user.id,
							},
							type:"get",
							dataType:"json",
							success:function(result) {
								$("#mycart_nums").text(parseInt(result.msg));
							}})
					}else{
						var $p="<p class=\"loginfo\">\n" +
								"        [<a href=\"login.html\">登录</a> <a class=\"reg\" href=\"adduser.html\">免费注册</a>]\n" +
								"    </p>";
						$("#login").html($p);
					}
				})
			</script>
			<div class="mycart">
				<dl>
					<dt>
						<a href="cart.jsp">购物车<b name="mycart_nums" id="mycart_nums">0</b>件
						</a>
					</dt>
					<dd>
						<a href="cart.jsp">去结算</a>
					</dd>
				</dl>
				<!--购物车浮动div 开始-->
				<div class="shopping" id="div_mycart" style="display: none;">
					<dl class="cartlist" id="shopcarDiv">
					</dl>
				</div>
			</div>
		</div>

		<div class="wrapper clearfix">
			<div class="sidebar f_l">
				<img src="images/front/ucenter/ucenter.gif" width="180" height="40">
				<div class="box">
					<div class="title">
						<h2>交易记录</h2>
					</div>
					<div class="cont">
						<ul class="list">
							<li><a href="myOrders.html" class="menu">我的订单</a></li>
						</ul>
					</div>
				</div>
				<div class="box">
					<div class="title">
						<h2 class="bg5">个人设置</h2>
					</div>
					<div class="cont">
						<ul class="list">
							<li><a href="address.jsp" class="menu">地址管理</a></li>
						</ul>
						<ul class="list">
							<li><a href="headPortrait.html" class="menu">修改头像</a></li>
						</ul>
						<ul class="list">
							<li><a href="modifyPassword.html" class="menu">修改密码</a></li>
						</ul>
					</div>
				</div>
			</div>
			<div class="main f_r" id="main">
				<div class="tabs">
					<div class="uc_title m_10 tabs_menu">
						<label class="current node"><span>修改密码</span></label>
					</div>
				</div>
				<table class="form_table" width="100%" cellpadding="0" cellspacing="0">
					<colgroup>
						<col width="120px">
						<col>
					</colgroup>
					<tbody>
						<tr>
							<th>原密码：</th>
							<td><input id="oldpwd" class="normal" type="text"><label></label></td>
						</tr>
						<tr>
							<th>新密码：</th>
							<td><input id="newpwd" class="normal" type="text"><label></label></td>
						</tr>
						<tr>
							<th>确认密码：</th>
							<td><input id="cfmpwd" class="normal" type="text"><label></label></td>
						</tr>
						<script src="js/jquery-3.6.0.js"></script>
						<script>
							$(function(){
								var user=JSON.parse(window.sessionStorage.getItem("user"));
								$("#updatepwd").on("click",function (event) {
									if(user.password!=$("#oldpwd").val()){
										alert("原密码不正确")
										return;
									}
									if($("#newpwd").val()!=$("#cfmpwd").val()){
										alert("两次密码请一致")
										return;
									}
									$.ajax({
										url:"User.do",
										data:{
											method:"update",
											id:user.id,
											password:$("#cfmpwd").val()
										},
										dataType:"json",
										type:"get",
										success:function(result){
											if(result.code==200){
												alert(result.msg);
												window.sessionStorage.setItem("user",JSON.stringify(result.data));
												location.href="modifyPassword.html"
											}else{
												alert("修改失败！")
											}
										}
									})
								})
							})
						</script>
						<tr>
							<th></th>
							<td><label class="btn"><input type="button" id="updatepwd" value="保存"></label> <label class="btn"><input type="button" id="cancel" value="取消"></label></td>
						</tr>
					</tbody>
				</table>
			</div>
		</div>
		<div class="help m_10">
			<div class="cont clearfix">
				<dl>
					<dt>
						<a href="">购物指南</a>
					</dt>
					<dd>
						<a href="">订单状态</a>
					</dd>
					<dd>
						<a href="">购物流程</a>
					</dd>
				</dl>
				<dl>
					<dt>
						<a href="">支付帮助</a>
					</dt>
					<dd>
						<a href="">支付帮助</a>
					</dd>
					<dd>
						<a href="">在线支付</a>
					</dd>
					<dd>
						<a href="">货到付款</a>
					</dd>
				</dl>
				<dl>
					<dt>
						<a href="">配送帮助</a>
					</dt>
					<dd>
						<a href="">EMS/邮政普包</a>
					</dd>
					<dd>
						<a href="">商品验货与签收</a>
					</dd>
					<dd>
						<a href="">配送范围及运费</a>
					</dd>
				</dl>
				<dl>
					<dt>
						<a href="">售后服务</a>
					</dt>
					<dd>
						<a href="">售后服务</a>
					</dd>
					<dd>
						<a href="">发票制度</a>
					</dd>
					<dd>
						<a href="">退货说明</a>
					</dd>
					<dd>
						<a href="">换货说明</a>
					</dd>
				</dl>
				<dl>
					<dt>
						<a href="">帮助信息</a>
					</dt>
					<dd>
						<a href="">友情链接</a>
					</dd>
					<dd>
						<a href="">联系客服</a>
					</dd>
					<dd>
						<a href="">找回密码</a>
					</dd>
					<dd>
						<a href="">关于我们</a>
					</dd>
				</dl>
			</div>
		</div>
		<div class="footer">
			<p class="links">
				<a href="">关于我们</a>|<a href="">常见问题</a>|<a href="">安全交易</a>|<a href="">购买流程</a>|<a href="">如何付款</a>|<a href="">联系我们</a>|<a href="">合作提案</a>
			</p>
			Copyright © 2015-2021 <a class="copyys" target="_blank" href="">蜀ICP备01000010号</a>
		</div>
	</div>


</body></html>
